package com.training.content.service.impl;

import java.util.List;
import com.training.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.training.content.mapper.CommonFileInfoMapper;
import com.training.content.domain.CommonFileInfo;
import com.training.content.service.ICommonFileInfoService;

/**
 * 公共文件Service业务层处理
 * 
 * @author training
 * @date 2021-10-25
 */
@Service
public class CommonFileInfoServiceImpl implements ICommonFileInfoService 
{
    @Autowired
    private CommonFileInfoMapper commonFileInfoMapper;

    /**
     * 查询公共文件
     * 
     * @param fileId 公共文件主键
     * @return 公共文件
     */
    @Override
    public CommonFileInfo selectCommonFileInfoByFileId(Long fileId)
    {
        return commonFileInfoMapper.selectCommonFileInfoByFileId(fileId);
    }

    /**
     * 查询公共文件列表
     * 
     * @param commonFileInfo 公共文件
     * @return 公共文件
     */
    @Override
    public List<CommonFileInfo> selectCommonFileInfoList(CommonFileInfo commonFileInfo)
    {
        return commonFileInfoMapper.selectCommonFileInfoList(commonFileInfo);
    }

    /**
     * 新增公共文件
     * 
     * @param commonFileInfo 公共文件
     * @return 结果
     */
    @Override
    public int insertCommonFileInfo(CommonFileInfo commonFileInfo)
    {
        commonFileInfo.setCreateTime(DateUtils.getNowDate());
        return commonFileInfoMapper.insertCommonFileInfo(commonFileInfo);
    }

    /**
     * 修改公共文件
     * 
     * @param commonFileInfo 公共文件
     * @return 结果
     */
    @Override
    public int updateCommonFileInfo(CommonFileInfo commonFileInfo)
    {
        commonFileInfo.setUpdateTime(DateUtils.getNowDate());
        return commonFileInfoMapper.updateCommonFileInfo(commonFileInfo);
    }

    /**
     * 批量删除公共文件
     * 
     * @param fileIds 需要删除的公共文件主键
     * @return 结果
     */
    @Override
    public int deleteCommonFileInfoByFileIds(Long[] fileIds)
    {
        return commonFileInfoMapper.deleteCommonFileInfoByFileIds(fileIds);
    }

    /**
     * 删除公共文件信息
     * 
     * @param fileId 公共文件主键
     * @return 结果
     */
    @Override
    public int deleteCommonFileInfoByFileId(Long fileId)
    {
        return commonFileInfoMapper.deleteCommonFileInfoByFileId(fileId);
    }
}
